package vn.orderonline.core.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import vn.orderonline.core.dao.common.GenericDaoImpl;
import vn.orderonline.core.dao.entity.City;

@Repository
public class CityDaoImpl extends GenericDaoImpl<City, Integer> implements
		CityDao {

	@Override
	public String getCityNameByCityId(Integer cityId) {
		Criteria criteria = getSession().createCriteria(City.class);
		criteria.setProjection(Projections.property("cityName"));
		criteria.add(Restrictions.eq("cityId", cityId));
		return (String) criteria.uniqueResult();
	}

}
